import lodash from 'lodash'
const getters = {
  isLogin: state => state.user.userInfo.userId !== -1,
  userInfo: state => state.user.userInfo,
  userId: state => state.user.userInfo.userId,
  userName: state => state.user.userInfo.userName,
  hasVoice: state => state.user.userInfo.hasVoice,
  isBeginner: state => state.user.userInfo.webBeginner,
  hasPassword: state => state.user.userInfo.hasPassword,
  unReadMsg: state => state.socket.unReadMsg,
  organizations: state => state.contact.organizations,
  groups: state => state.contact.groups,
  friends: state => state.contact.friends,
  friendsUnflod: state => {
    const friends = []
    state.contact.friends.forEach(({ organizationFriendList: friendList }) => {
      friends.push(...lodash.cloneDeep(friendList))
    })
    return friends
  }
}

export default getters
